﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class ForeignLanguageBL
	{

		#region ***** Init Methods ***** 
		ForeignLanguageDA objForeignLanguageDA;
		public ForeignLanguageBL()
		{
			objForeignLanguageDA = new ForeignLanguageDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get ForeignLanguage by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>ForeignLanguage</returns>
		public ForeignLanguage GetByID(int id)
		{
			return objForeignLanguageDA.GetByID(id);
		}

		/// <summary>
		/// Get all of ForeignLanguage
		/// </summary>
		/// <returns>List<<ForeignLanguage>></returns>
		public List<ForeignLanguage> GetList()
		{
			string cacheName = "lstForeignLanguage";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objForeignLanguageDA.GetList(), "ForeignLanguage");
			}
			return (List<ForeignLanguage>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of ForeignLanguage
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsForeignLanguage";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objForeignLanguageDA.GetDataSet(), "ForeignLanguage");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of ForeignLanguage paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<ForeignLanguage>></returns>
		public List<ForeignLanguage> GetListPaged(int recperpage, int pageindex)
		{
			return objForeignLanguageDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of ForeignLanguage paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objForeignLanguageDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new ForeignLanguage within ForeignLanguage database table
		/// </summary>
		/// <param name="obj_foreignlanguage">ForeignLanguage</param>
		/// <returns>key of table</returns>
		public int Add(ForeignLanguage obj_foreignlanguage)
		{
			ServerCache.Remove("ForeignLanguage", true);
			return objForeignLanguageDA.Add(obj_foreignlanguage);
		}

		/// <summary>
		/// updates the specified ForeignLanguage
		/// </summary>
		/// <param name="obj_foreignlanguage">ForeignLanguage</param>
		/// <returns></returns>
		public void Update(ForeignLanguage obj_foreignlanguage)
		{
			ServerCache.Remove("ForeignLanguage", true);
			objForeignLanguageDA.Update(obj_foreignlanguage);
		}

		/// <summary>
		/// Delete the specified ForeignLanguage
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("ForeignLanguage", true);
			objForeignLanguageDA.Delete(id);
		}
		#endregion
	}
}
